classdef ModelImportClass < handle
    %MODELIMPORTCLASS Summary of this class goes here
    %   Detailed explanation goes here
    
    properties (SetAccess = private)

    end
    
    methods
        function obj = ModelImportClass(GVC)
            % ModelImportClass constructor
            
            % Set up the menu
            importModMenuH = uimenu(GVC.figureH,...
                'Label','Import Models');
            uimenu(importModMenuH,...
                'Label','UBC mesh and model files',...
                'Callback',{@obj.importModMshFile,GVC});
            uimenu(importModMenuH,...
                'Label','Import GIFtools files',...
                'Callback',{@obj.importGIFtoolObj,GVC});
            
        end % End contructor
        
        % Callback methods
        function importModMshFile(obj,~,~,GVC)
            % Function to read in a mod and msh UBC files
            
            % Select the mesh file
            [meshfile,meshpath,meshfilterIndex] = uigetfile(...
                {'*.msh;*.mesh;*.txt','UBC mesh ascii files (*.msh,*.mesh,*.txt)';...
                '*.*','All files (*.*)'},...
                'Select a UBC mesh file');
            
            % Select the mod file
            [modfile,modpath,modfilterIndex] = uigetfile(...
                {'*.sus;*.grv;*.con;*.txt','UBC mod ascii files (*.sus,*.grv,*.con,*.txt)';...
                '*.*','All files (*.*)'},...
                'Select a UBC mod file');
            % Implement the model files for selection the units.
            % Import into GIFtools
            viewerParent = GIFproject;
            importMod = GIFmodel.importGIFMeshModelFiles(viewerParent,...
            [meshpath meshfile],[modpath modfile],'unitless','InternalName');
            
            % Close and reopen the model
            close(GVC.figureH);
            delete(GVC);clear GVC;
            GVC = GIFviewClass(importMod);
            
        end
        
        
        function importGIFtoolObj(obj,~,~,GVC)
            disp('Not implemented yet.');
        end
        
    end % End methods
end % End classdef